//Bane of the Living
//7DRL version

#include <cstdlib>
#include <ctime>
#include <panel.h>
#include "extras.h"
#include "actor.h"
#include "item.h"
#include "tile.h"
#include "queue.h"
#include "level.h"
#include "buffer.h"
#include "game.h"
using namespace std;

WINDOW* mapwin; WINDOW* statwin; WINDOW* msgwin;
PANEL*  mappan; PANEL*  statpan; PANEL*  msgpan;
WINDOW* pr_window;

Actor Player,LoadedActor[NUM_ACTORS];
AttackInfo LoadedAttack[NUM_ATTACKS];
Item LoadedItem[NUM_ITEMS];
Tile LoadedTile[NUM_TILES];
Queue Q;
Level Map;
Buffer Buff;
GameInfo Game;

int main(){
	initscr(); noecho(); raw();
	keypad(stdscr,true); keypad(statwin,true); keypad(msgwin,true); keypad(mapwin,true);
	start_color();
	#ifndef _WIN32
	ESCDELAY=0;
	#else
	curs_set(0); //untested. this is supposed to make the cursor disappear on windows because my panels code isn't quite pdcurses-friendly yet
	#endif
	for(int i=1;i<=7;++i){
		init_pair(i,i,0);
	}
	statwin = newwin(ROWS+1,13,0,0); wattron(statwin,A_BOLD);
	msgwin = newwin(1,COLS,0,13); wattron(msgwin,A_BOLD);
	mapwin = newwin(ROWS,COLS,1,13);
	pr_window = NULL;
	statpan = new_panel(statwin);
	msgpan = new_panel(msgwin);
	mappan = new_panel(mapwin);
	srand(time(NULL));
	Player.Q0();
	Game.InitTiles();
	Game.InitAttacks();
	Game.InitActors();
	Game.InitItems();
	Game.InitPlayer();
	Game.GenerateLevel(TOWN);
	Buff.Rec("Welcome to the 7DRL version of Bane of the Living! ");
	Buff.Rec("Pressing A through D summons your minions. ");
	Buff.Rec("F feeds them a corpse to heal them. ");
	Buff.Rec("R recalls them to you. N gives them nicknames. Good luck! ");
	while(true){ Q.Pop(); }
	endwin();
	return 0;
}

